/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dataaccess;

import java.util.ArrayList;
import java.util.Map;

/**
 *
 * @author littlechild
 */
public interface IDataSource {
    /**
     * The following three functions should be used in
     * manipulating DetailInfo only.
     * @param id
     * @return
     */
    abstractmodel.IInfo loadDetailInfo(int id);
    boolean saveDetailInfo(abstractmodel.IInfo info);
    boolean deleteDetailInfo(abstractmodel.IInfo info);
    /**
     * @param filter
     * see "filter_semantics.pdf" for detail
     * @param info
     * @return
     */
    ArrayList<abstractmodel.IInfo> search(String filter, Class info); 
    /**
     * The following there function is used in 
     * manipulating User data.
     * Notice: the following there function is based on the assumption that
     * DetailInfo is not included in the Account.
     * @param user
     * @return
     */
    boolean saveUser(abstractmodel.IUser user);
    abstractmodel.IUser loadUser(String name);
    boolean deleteUser(abstractmodel.IUser user);
    /**
     * load information which is useful to check the password
     * the user name and md5(password) is saved in the map
     * @return
     */
    Map loadLogInInfo();
    boolean saveLogInInfo(Map map);
    void close();
}
